/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.musiclibrary.api.transfers;

import cz.muni.fi.pa165.musiclibrary.api.dto.GenreDTO;
import cz.muni.fi.pa165.musiclibrary.api.entities.Genre;

/**
 *
 * @author Dominik
 */
public class GenreT {
    public static GenreDTO GenreToDTO(Genre genre){
        if (genre == null) {
            throw new IllegalArgumentException();
        }
        
        GenreDTO genreDTO = new GenreDTO();
        
        genreDTO.setId(genre.getId());
        genreDTO.setName(genre.getName());
                
        return genreDTO;        
    }
    
    public static Genre DTOtoGenre(GenreDTO genreDTO){
        
        if (genreDTO == null) {
            throw new IllegalArgumentException();
        }
        
        Genre genre = new Genre(); 
        
        genre.setId(genreDTO.getId());
        genre.setName(genreDTO.getName());
                
        return genre;     
    }     
}
